<script setup>
	import {
		ref
	} from 'vue';
	// 导入云对象
	const demoObj = uniCloud.importObject("demoObj");

	const dataList = ref([])

	// 获取数据
	const getData = async () => {
		let {
			data
		} = await demoObj.getUser(7);
		dataList.value = data;
		console.log(data);
	}
	// 新增用户
	const handleAddUser = async () => {
		let res = await demoObj.addUser({
			name: "小黑",
			age: "22",
			gender: 1
		});
		console.log(res);
	}

	getData();
</script>
<template>
	<view class="">
		<button @click="handleAddUser">新增用户</button>

		<view class="item" v-for="item in dataList" :key="item._id">
			<view>{{item.name}}</view>
			<view>{{item.age}}</view>
			<view>-------</view>
		</view>
	</view>
</template>
<style lang="scss" scoped>

</style>